package com.teamAwesome.nfcAlarm;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

/** Allows users to add a new alarm */
public class EditAlarmActivity extends Activity implements OnClickListener {

    private static final String TAG = "EditAlarmActivity";
    @SuppressWarnings("unused")
    private String alarmLabel;
    Button alarmLabelBtn;
    Button saveBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.alarm_settings);

	alarmLabelBtn = (Button) findViewById(R.id.alarmLabelBtn);
	alarmLabelBtn.setOnClickListener(this);
	saveBtn = (Button) findViewById(R.id.saveBtn);
	saveBtn.setOnClickListener(this);
    }

    public void onClick(View v) {
	Log.d(TAG, "entered onClick");
	switch (v.getId()) {

	case R.id.alarmLabelBtn:
	    Log.d(TAG, "Alarm Label Button Clicked");

	    AlertDialog.Builder alert = new AlertDialog.Builder(this);

	    alert.setTitle("Title");
	    alert.setMessage("Message");

	    final EditText input = new EditText(this);

	    alert.setView(input);

	    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
		public void onClick(DialogInterface dialog, int whichButton) {
		    alarmLabel = input.getText().toString();
		    dialog.dismiss();
		}
	    });

	    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
		public void onClick(DialogInterface dialog, int whichButton) {
		    dialog.cancel();
		}
	    });

	    alert.show();

	    break;

	case R.id.saveBtn:
	    break;

	default:
	    Log.d(TAG, "No onClick listener found");

	}

    }

}
